<%@ page language="java" contentType= "text/html" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.jm.web.GridPage" %>
<%@ page import="common.CommonType" %>
<%@ page import="com.jm.web.data.JMForm" %>
<%@ page import="com.jm.utils.Utils" %>
<%@ page import="com.jm.utils.StringHelper" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
GridPage page1= new GridPage();page1.setLoadData(true);page1.PreparePageEnv(pageContext);

Utils utils = new Utils(request);
JMForm form = utils.getForm();

String companyCodeTsn = StringHelper.getValue(utils.getsv("companyCodeTsn"), "2");
if(!form.ContainesParam("companyCodeTsn"))
	form.spsv("companyCodeTsn",companyCodeTsn);	
	
companyCodeTsn = form.gpsv("companyCodeTsn");

String whr = "";
if(!form.isNullOrEmpty("hr003atsn"))
	whr = StringHelper.Format("where tsn in(%1$s)",form.gpsv("hr003atsn"));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="overflow: auto !important;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/include/common_include.jsp"%>
<script language="JavaScript" charset="UTF-8"> 
function send(val,tsn,chname) { 
	var hr003aoption = $('select[name=companyCodeTsn] option:selected');
	top.returnValue = {};
	top.returnValue.text = val;
	top.returnValue.value = tsn;
	top.returnValue.chname = chname;
	top.returnValue.hr003atsn = hr003aoption.val();
	top.returnValue.hr003aname = hr003aoption.text();
	top.returnValue.ret = 'ok';
	top.close();
}
</script>
</head>
<body style="overflow: auto !important;">
<form>
<%
try {
%>
<jm:dp id="dp1" data="<%=Utils.TAG_FORM%>" tabSize="0">
	<jm:tab>
		<dp colModel="100%">
		<input type="hidden" name="hr003atsn" />
		<jm:select caption="公司別" captionWidth="40px" utils="<%=utils%>" name="companyCodeTsn" dataSource="info3" sql="<%=StringHelper.Format("select tsn,companyNamech as i18n_companyNamech from hr..hr003a %1$s",whr)%>" onchange="submit();" />
		<group />
		</dp>
	</jm:tab>
</jm:dp>
<%
Map map = new HashMap();
Map mapRole = new HashMap();
List list = new ArrayList();
List listOne = new ArrayList();
List list2 = new ArrayList();
List list3 = new ArrayList();
List list4 = new ArrayList();
List list5 = new ArrayList();
List list6 = new ArrayList();
List list7 = new ArrayList();
List list8 = new ArrayList();
//List list9 = new ArrayList();
//List list10 = new ArrayList();
//List list11 = new ArrayList();
//List list12 = new ArrayList();
//List list13 = new ArrayList();
//List list14 = new ArrayList();
//List list15 = new ArrayList();
//List list16 = new ArrayList();
if("".equals(companyCodeTsn)) {
out.print("<a style=cursor:pointer; onclick=send('','','');window.close()><font size=1>|---空白</font></a><br>");
} else {
CommonType commonType = new CommonType(utils);
map = commonType.role(companyCodeTsn);

	mapRole = commonType.orgTitleSn(companyCodeTsn);

		list = (List)map.get("0");
		if(list != null) {
			for(int i = 0; i < list.size(); i++) {
			out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list.get(i)).toString())+"','"+list.get(i)+"','"+mapRole.get(list.get(i)).toString()+"');window.close();\"><font size=1>|---"+utils.i18n(mapRole.get(list.get(i)).toString())+"</font></a><br>");
				listOne = (List)map.get(list.get(i));
			if(listOne != null) {
			for(int j = 0; j < listOne.size(); j++) {
				out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(listOne.get(j)).toString())+"','"+listOne.get(j)+"','"+mapRole.get(listOne.get(j)).toString()+"');window.close();\"><font size=1>　　　|---"+utils.i18n(mapRole.get(listOne.get(j)).toString())+"</font></a><br>");
					list2 = (List)map.get(listOne.get(j));
				if(list2 != null) {
				for(int h = 0; h < list2.size(); h++) {
					out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list2.get(h)).toString())+"','"+list2.get(h)+"','"+mapRole.get(list2.get(h)).toString()+"');window.close();\"><font size=1>　　　　　　|---"+utils.i18n(mapRole.get(list2.get(h)).toString())+"</font></a><br>");
						list3 = (List)map.get(list2.get(h));
					if(list3 != null) {
					for(int g = 0; g < list3.size(); g++) {
						out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list3.get(g)).toString())+"','"+list3.get(g)+"','"+mapRole.get(list3.get(g)).toString()+"');window.close();\"><font size=1>　　　　　　　　　|---"+utils.i18n(mapRole.get(list3.get(g)).toString())+"</font></a><br>");
							list4 = (List)map.get(list3.get(g));
						if(list4 != null) {
						for(int f = 0; f < list4.size(); f++) {
							out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list4.get(f)).toString())+"','"+list4.get(f)+"','"+mapRole.get(list4.get(f)).toString()+"');window.close();\"><font size=1>　　　　　　　　　　　　|---"+utils.i18n(mapRole.get(list4.get(f)).toString())+"</font></a><br>");
								list5 = (List)map.get(list4.get(f));
							if(list5 != null) {
							for(int d = 0; d < list5.size(); d++) {
								out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list5.get(d)).toString())+"','"+list5.get(d)+"','"+mapRole.get(list5.get(d)).toString()+"');window.close();\"><font size=1>　　　　　　　　　　　　　　　|---"+utils.i18n(mapRole.get(list5.get(d)).toString())+"</font></a><br>");
									list6 = (List)map.get(list5.get(d));
								if(list6 != null) {
								for(int s = 0; s < list6.size(); s++) {
									out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list6.get(s)).toString())+"','"+list6.get(s)+"','"+mapRole.get(list6.get(s)).toString()+"');window.close();\"><font size=1>　　　　　　　　　　　　　　　　　　|---"+utils.i18n(mapRole.get(list6.get(s)).toString())+"</font></a><br>");
										list7 = (List)map.get(list6.get(s));
										if(list7 != null) {
										for(int a = 0; a < list7.size(); a++) {
											out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list7.get(a)).toString())+"','"+list7.get(a)+"','"+mapRole.get(list7.get(a)).toString()+"');window.close();\"><font size=1>　　　　　　　　　　　　　　　　　　　　　|---"+utils.i18n(mapRole.get(list7.get(s)).toString())+"</font></a><br>");
												list8 = (List)map.get(list7.get(a));
												if(list8 != null) {
												for(int q = 0; q < list8.size(); q++) {
													out.println("<a style=cursor:pointer; onclick=\"send('"+utils.i18n(mapRole.get(list8.get(q)).toString())+"','"+list8.get(q)+"','"+mapRole.get(list8.get(q)).toString()+"');window.close();\"><font size=1>　　　　　　　　　　　　　　　　　　　　　　　　|---"+utils.i18n(mapRole.get(list8.get(s)).toString())+"</font></a><br>");
												}
												}
										}
										}
								}
								}
							}
							}	
						}
						}	
					}
					}
				}
				}
			}
			}
		}
		}
		out.println();

}
} catch(Exception ex) {
	utils.recordException(ex);
	throw ex;
} finally {
	utils.cleanUp();
}
%>
  </form>
  </body>
</html>
